package com.tian.print.app;

import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.OnLifecycleEvent;
import android.util.Log;

/**
 * Description: 利用LifeCycle处理内存的泄露
 * <br>Author：tian
 * <br>Time: 2019/5/24 17:30
 */
public class BasePresenter implements LifecycleObserver {

    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    protected void onCreate(LifecycleOwner owner) {
        Log.d(getClass().getSimpleName(), "---onCreate---");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    protected void onStart(LifecycleOwner owner) {
        Log.d(getClass().getSimpleName(), "---onStart---");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    protected void onStop(LifecycleOwner owner) {
        Log.d(getClass().getSimpleName(), "---onStop---");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    protected void onResume(LifecycleOwner owner) {
        Log.d(getClass().getSimpleName(), "---onResume---");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    protected void onPause(LifecycleOwner owner) {
        Log.d(getClass().getSimpleName(), "---onPause---");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    protected void onDestory(LifecycleOwner owner) {
        Log.d(getClass().getSimpleName(), "---onDestory---");
    }
}
